import { Skeleton } from '@nutui/nutui-react-taro';
import { pxTransform } from '@tarojs/taro';
import { CSSProperties } from 'react';
import styles from './style.scss';

type Props = {
  width?: number;
  height?: number;
  style?: CSSProperties;
};

export default (props: Props) => {
  const { width, height, style = {} } = props;
  return (
    <Skeleton
      className={styles.skeleton}
      animated
      style={{
        width: width ? pxTransform(width) : undefined,
        height: height ? pxTransform(height) : undefined,
        ...style,
      }}
    />
  );
};
